using UnityEngine;

public class TransportButtonController : SelectableButtonController
{
	public UICenterOnChild centrOnChield;

	public float maxScale = 2f;

	public float minScale = 0.25f;

	public float maxDistance = 3f;

	private void Awake()
	{
		centrOnChield.onCenter = SelectFromCenter;
	}

	private void SelectFromCenter(GameObject centerd)
	{
		if (!(centerd == null))
		{
			CellChooseTransport component = centerd.GetComponent<CellChooseTransport>();
			if (component != null)
			{
				SelectButton(component);
			}
		}
	}

	public override bool SelectButton(SelectableButton buttonToSelect)
	{
		if (buttonToSelect != selectedButton && (centrOnChield.centeredObject == null || buttonToSelect.transform != centrOnChield.centeredObject.transform))
		{
			centrOnChield.CenterOn(buttonToSelect.transform);
		}
		base.SelectButton(buttonToSelect);
		return true;
	}

	public void Reset()
	{
		GetComponent<UIScrollView>().ResetPosition();
		centrOnChield.Recenter();
	}
}
